using System;
using System.Collections.Generic;

namespace Tarkin.Mof.Common
{
    /// <summary>
    /// The ReflectiveCollection class is the implementation of the class as defined
    /// by section 10.6 of the Meta Object Facility (MOF) Core Specification (version 
    /// 2.0, dated January 2006).
    /// </summary>
    /// <remarks>Tarkin classes are NOT thread-safe.</remarks>
    public class ReflectiveCollection
    {

#region Private Members

        private IList < Object > objects = null;

#endregion


#region Protected Properties

        protected IList < Object > Objects
        {
            get
            {
                if ( objects == null )
                {
                    objects = new List < object > ();
                }

                return objects;
            }
        }

#endregion


#region Constrcutors



#endregion


#region Public Properties

        public int Size
        {
            get
            {
                return Objects.Count;
            }
        }

#endregion


#region Public Methods

        public bool Add ( Object objectToAdd )
        {
            Objects.Add ( objectToAdd );

            return true;
        }

        public bool AddAll ( ReflectiveSequence elements )
        {
            for ( int i = 0; i < elements.Size; i++ )
            {
                Objects.Add ( elements.Get ( i ) );
            }
        }

        public bool Remove ( Object objectToRemove )
        {
            return Objects.Remove ( objectToRemove );
        }

        public void Clear ()
        {
            Objects.Clear ();
        }


#endregion

    }
}
